<template>
	<page-meta :page-style="'overflow:'+(show?'hidden':'visible')"></page-meta>
	<view class="param-contents">
		<h5 class="param-title">{{paramTitle}}</h5>
		<!-- 主控参数查询 -->
		<view v-if="type==0">
			<view class="param-one">
				<text>当前连接的平台</text>
				<uni-data-select class="sliders" placeholder="请选择连接的平台" v-model="masterInfo.param1"
					:key="masterInfo.param1" :localdata="CURRENT_PLATFORM"></uni-data-select>
			</view>
			<view class="param-one">
				<text>仓控制板数目</text>
				<input v-model="masterInfo.param2" class="uni-input" type="digit" @input="onKeyInput($event,'param2')"
					placeholder="请输入仓控制板数目" />
			</view>
			<view class="param-one">
				<text>从柜数目</text>
				<input v-model="masterInfo.param3" class="uni-input" type="digit" @input="onKeyInput($event,'param3')"
					placeholder="请输入从柜数目" />
			</view>
			<u-tag text="长度为20个字节,不足部分补0" type="error" />
			<view class="param-one">
				<text>进入后台密码</text>
				<input v-model="masterInfo.param4" :maxlength="20" class="uni-input" placeholder="请输入进入后台密码" />
			</view>
		</view>
		<!-- 仓控参数查询 -->
		<view v-else-if="type==1">
			<view class="bin-card">
				<view class="bin-one" v-for="(one,index) in Number(binNum)" :key="index">
					<view class="bin-border" @click="binPopup(index)">{{index+1}}号仓</view>
				</view>
			</view>
		</view>
		<!-- 检测单元参数查询 -->
		<view v-else-if="type==2">
			<view class="bin-card">
				<view class="bin-one box-one" v-for="(one,index) in comCabinNum" :key="index" :is-shadow="false">
					<view class="bin-border" @click="unitPopup(index)">检测单元{{index+1}}</view>
				</view>
			</view>
		</view>

		<!-- 柜控电源 -->
		<view v-else-if="type==3">
			<view class="bin-card">
				<view class="bin-one box-one" v-for="(one,index) in comCabinNum" :key="index" :is-shadow="false">
					<view class="bin-border" @click="cabinetPopup(index)">柜控电源{{index+1}}</view>
				</view>
			</view>
		</view>

		<!-- 整流电源 -->
		<view v-else-if="type==4">
			<view class="bin-card">
				<view class="bin-one box-one" v-for="(one,index) in comCabinNum*3" :key="index" :is-shadow="false">
					<view class="bin-border" @click="powerPopup(index)">整流电源{{index+1}}</view>
				</view>
			</view>
		</view>

		<!-- 充电电源 -->
		<view v-else-if="type==5">
			<view class="bin-card">
				<view class="bin-one box-one" v-for="(one,index) in Number(binNum)" :key="index" :is-shadow="false">
					<view class="bin-border" @click="chargePopup(index)">充电电源{{index+1}}</view>
				</view>
			</view>
		</view>

		<!-- 电池 -->
		<view v-else-if="type==6">
			<view class="bin-card">
				<view class="bin-one" v-for="(one,index) in Number(binNum)" :key="index" :is-shadow="false">
					<view class="bin-border" @click="batteryPopup(index)">电池{{index+1}}</view>
				</view>
			</view>
		</view>

		<!-- 操作按钮 -->
		<view class="operate_btns" v-if="type==0">
			<u-button type="success" size="medium" @click="isSetting">设置</u-button>
			<u-button type="primary" size="medium" class="set_btn" @click="isRefresh">读取</u-button>
		</view>

		<!-- 仓详情 弹框 -->
		<uni-popup ref="binpopup" type="center" class="bin_popup" :animation="false" :is-mask-click="false"
			@change="change">
			<view class="alertbox binpopbox">
				<uni-icons class="closeempty" type="closeempty" size="30" color="#6A6A6A"
					@click="closeBinpopup('binpopup')"></uni-icons>
				<view class="bin_left">
					{{currentIndex}}号仓
				</view>
				<h5 class="param-title detail-name">电锁反馈设置</h5>
				<view class="param-one">
					<text>门锁反馈信号1</text>
					<uni-data-select class="sliders" placeholder="请选择门锁反馈信号1" v-model="binDetail.param1"
						:localdata="LOCK_SIGNAL"></uni-data-select>
				</view>
				<view class="param-one">
					<text>门锁反馈信号2</text>
					<uni-data-select class="sliders" placeholder="请选择门锁反馈信号2" v-model="binDetail.param2"
						:localdata="LOCK_SIGNAL"></uni-data-select>
				</view>
				<view class="param-one">
					<text>门锁反馈信号3</text>
					<uni-data-select class="sliders" placeholder="请选择门锁反馈信号3" v-model="binDetail.param3"
						:localdata="LOCK_SIGNAL"></uni-data-select>
				</view>
				<view class="param-one">
					<text>门锁反馈信号4</text>
					<uni-data-select class="sliders" placeholder="请选择门锁反馈信号4" v-model="binDetail.param4"
						:localdata="LOCK_SIGNAL"></uni-data-select>
				</view>
				<view class="param-one">
					<text>门锁反馈信号1设置</text>
					<uni-data-select class="sliders" placeholder="请选择门锁反馈信号1设置" v-model="binDetail.param5"
						:localdata="LOCK_SIGNAL_SET"></uni-data-select>
				</view>
				<view class="param-one">
					<text>门锁反馈信号2设置</text>
					<uni-data-select class="sliders" placeholder="请选择门锁反馈信号2设置" v-model="binDetail.param6"
						:localdata="LOCK_SIGNAL_SET"></uni-data-select>
				</view>
				<view class="param-one">
					<text>门锁反馈信号3设置</text>
					<uni-data-select class="sliders" placeholder="请选择门锁反馈信号3设置" v-model="binDetail.param7"
						:localdata="LOCK_SIGNAL_SET"></uni-data-select>
				</view>
				<view class="param-one">
					<text>门锁反馈信号4设置</text>
					<uni-data-select class="sliders" placeholder="请选择门锁反馈信号4设置" v-model="binDetail.param8"
						:localdata="LOCK_SIGNAL_SET"></uni-data-select>
				</view>

				<h5 class="param-title detail-name">灭火器反馈设置</h5>
				<view class="param-one">
					<text>灭火器反馈</text>
					<uni-data-select class="sliders" placeholder="请选择灭火器反馈" v-model="binDetail.param9"
						:localdata="LOCK_SIGNAL"></uni-data-select>
				</view>

				<view class="param-one">
					<text>灭火器反馈设置</text>
					<uni-data-select class="sliders" placeholder="请选择灭火器反馈设置" v-model="binDetail.param10"
						:localdata="LOCK_SIGNAL_SET"></uni-data-select>
				</view>

				<view class="param-one">
					<text>电锁反馈点数量</text>
					<input v-model="binDetail.param11" class="uni-input" type="digit"
						@input="onKeyInput($event,'param11')" placeholder="请输入电锁反馈点数量" />
				</view>
				<h5 class="param-title detail-name">在位反馈设置</h5>
				<view class="param-one">
					<text>在位反馈设置</text>
					<uni-data-select class="sliders" placeholder="请选择在位反馈设置" v-model="binDetail.param12"
						:localdata="LOCK_SIGNAL"></uni-data-select>
				</view>
				<view class="param-one">
					<text>在位反馈设置</text>
					<uni-data-select class="sliders" placeholder="请选择在位反馈设置" v-model="binDetail.param13"
						:localdata="LOCK_SIGNAL_SET"></uni-data-select>
				</view>

				<!-- 操作按钮 -->
				<view class="operate_btns">
					<u-button type="success" size="medium" @click="isSetting">设置</u-button>
					<u-button type="primary" size="medium" class="set_btn"
						@click="isRefresh(currentIndex)">读取</u-button>
				</view>
			</view>
		</uni-popup>
		<!-- 检测单元 弹框-->
		<uni-popup ref="unitpopup" type="center" class="bin_popup" :animation="false" :is-mask-click="false">
			<view class="alertbox binpopbox">
				<uni-icons class="closeempty" type="closeempty" size="30" color="#6A6A6A"
					@click="closeBinpopup('unitpopup')"></uni-icons>
				<view class="binparam">
					<view class="bin_left">
						检测单元{{currentIndex}}
					</view>
					<view class="param-one">
						<text>设置烟感反馈点</text>
						<uni-data-select class="sliders" placeholder="请选择设置烟感反馈点" v-model="unitInfo.param1"
							:key="unitInfo.param1" :localdata="SMOKE_FEEDBACK"></uni-data-select>
					</view>
					<view class="param-one">
						<text>设置维护门反馈数量</text>
						<input v-model="unitInfo.param2" class="uni-input inputs" type="digit"
							placeholder="请输入设置维护门反馈数量" />
					</view>
					<h5 class="param-title detail-name">设置维护门反馈点</h5>
					<view class="param-one">
						<text>维护门反馈点1</text>
						<uni-data-select class="sliders" placeholder="请选择维护门反馈点1" v-model="unitInfo.param3"
							:key="unitInfo.param3" :localdata="LOCK_STATUS"></uni-data-select>
					</view>
					<view class="param-one">
						<text>维护门反馈点2</text>
						<uni-data-select class="sliders" placeholder="请选择维护门反馈点2" v-model="unitInfo.param4"
							:key="unitInfo.param4" :localdata="LOCK_STATUS"></uni-data-select>
					</view>
					<view class="param-one">
						<text>维护门反馈点1设置使能</text>
						<uni-data-select class="sliders" placeholder="请选择维护门反馈点1设置使能" v-model="unitInfo.param5"
							:key="unitInfo.param5" :localdata="DOOR_FEEDBACK"></uni-data-select>
					</view>
					<view class="param-one">
						<text>维护门反馈点2设置使能</text>
						<uni-data-select class="sliders" placeholder="请选择维护门反馈点2设置使能" v-model="unitInfo.param6"
							:key="unitInfo.param6" :localdata="DOOR_FEEDBACK"></uni-data-select>
					</view>

					<view class="param-one">
						<text>设置消防反馈点状态</text>
						<uni-data-select class="sliders" placeholder="请选择设置消防反馈点状态" v-model="unitInfo.param7"
							:key="unitInfo.param7" :localdata="SMOKE_FEEDBACK"></uni-data-select>
					</view>
					<view class="param-one">
						<text>设置水位检测反馈点</text>
						<uni-data-select class="sliders" placeholder="请选择设置水位检测反馈点" v-model="unitInfo.param8"
							:key="unitInfo.param8" :localdata="SMOKE_FEEDBACK"></uni-data-select>
					</view>
					<view class="param-one">
						<text>水侵使能</text>
						<uni-data-select class="sliders" placeholder="请选择水侵使能" v-model="unitInfo.param9"
							:key="unitInfo.param9" :localdata="WATER_STATUS"></uni-data-select>
					</view>
					<view class="param-one">
						<text>烟雾使能</text>
						<uni-data-select class="sliders" placeholder="请选择烟雾使能" v-model="unitInfo.param10"
							:key="unitInfo.param10" :localdata="WATER_STATUS"></uni-data-select>
					</view>
					<u-tag text="过温点设置区间:-30~ 120℃；默认80℃。255表示不设置" type="error" />
					<view class="param-one">
						<text>过温点设置</text>
						<input v-model="unitInfo.param11" class="uni-input inputs" type="digit" placeholder="请输入过温点" />℃
					</view>

					<view class="param-one">
						<text>水流检测使能</text>
						<uni-data-select class="sliders" placeholder="请选择水流检测使能" v-model="unitInfo.param12"
							:key="unitInfo.param12" :localdata="WATER_STATUS"></uni-data-select>
					</view>
					<view class="param-one">
						<text>水箱水位检测使能</text>
						<uni-data-select class="sliders" placeholder="请选择水箱水位检测使能" v-model="unitInfo.param13"
							:key="unitInfo.param13" :localdata="WATER_STATUS"></uni-data-select>
					</view>
				</view>
			</view>
		</uni-popup>
		<!-- 整流电源 弹框-->
		<uni-popup ref="powerpopup" type="center" class="bin_popup" :animation="false" :is-mask-click="false">
			<view class="alertbox binpopbox">
				<uni-icons class="closeempty" type="closeempty" size="30" color="#6A6A6A"
					@click="closeBinpopup('powerpopup')"></uni-icons>
				<view class="binparam">
					<view class="bin_left">
						整流电源{{currentIndex}}
					</view>
					<view class="param-one">
						<text>高温保护值</text>
						<input v-model="powerInfo.param1" class="uni-input inputs" type="digit"
							placeholder="请输入高温保护值" />℃
					</view>
					<view class="param-one">
						<text>高温恢复值</text>
						<input v-model="powerInfo.param2" class="uni-input inputs" type="digit"
							placeholder="请输入输出欠压保护值" />℃
					</view>
					<view class="param-one">
						<text>低温保护值</text>
						<input v-model="powerInfo.param3" class="uni-input inputs" type="digit"
							placeholder="请输入低温保护值" />℃
					</view>
					<view class="param-one">
						<text>低温恢复值</text>
						<input v-model="powerInfo.param4" class="uni-input inputs" type="digit"
							placeholder="请输入低温恢复值" />℃
					</view>
					<view class="param-one">
						<text>输入过压保护值</text>
						<input v-model="powerInfo.param5" class="uni-input inputs" type="digit"
							placeholder="请输入输入过压保护值" />V
					</view>
					<view class="param-one">
						<text>输入过压恢复值</text>
						<input v-model="powerInfo.param6" class="uni-input inputs" type="digit"
							placeholder="请输入输出欠压保护值" />V
					</view>
					<view class="param-one">
						<text>输入欠压保护值</text>
						<input v-model="powerInfo.param7" class="uni-input inputs" type="digit"
							placeholder="输入欠压保护值" />V
					</view>
					<view class="param-one">
						<text>输入欠压恢复值</text>
						<input v-model="powerInfo.param8" class="uni-input inputs" type="digit"
							placeholder="输入欠压恢复值" />V
					</view>
					<view class="param-one">
						<text>输出过压保护值</text>
						<input v-model="powerInfo.param9" class="uni-input inputs" type="digit"
							placeholder="输出过压保护值" />V
					</view>
					<view class="param-one">
						<text>输出欠压保护值</text>
						<input v-model="powerInfo.param10" class="uni-input inputs" type="digit"
							placeholder="输出欠压保护值" />V
					</view>
					<view class="param-one">
						<text>输出过流保护值</text>
						<input v-model="powerInfo.param11" class="uni-input inputs" type="digit"
							placeholder="输出过流保护值" />A
					</view>
				</view>
			</view>
		</uni-popup>

		<!-- 充电电源 弹框 -->
		<uni-popup ref="chargepopup" type="center" class="bin_popup" :animation="false" :is-mask-click="false">
			<view class="alertbox binpopbox">
				<uni-icons class="closeempty" type="closeempty" size="30" color="#6A6A6A"
					@click="closeBinpopup('chargepopup')"></uni-icons>
				<view class="binparam">
					<view class="bin_left">
						充电电源{{currentIndex}}
					</view>
					<view class="param-one">
						<text>高温保护值</text>
						<input v-model="chargeInfo.param1" class="uni-input inputs" type="digit" placeholder="高温保护值" />℃
					</view>
					<view class="param-one">
						<text>高温恢复值</text>
						<input v-model="chargeInfo.param2" class="uni-input inputs" type="digit" placeholder="高温恢复值" />℃
					</view>
					<view class="param-one">
						<text>低温保护值</text>
						<input v-model="chargeInfo.param3" class="uni-input inputs" type="digit" placeholder="低温保护值" />℃
					</view>
					<view class="param-one">
						<text>低温恢复值</text>
						<input v-model="chargeInfo.param4" class="uni-input inputs" type="digit" placeholder="低温恢复值" />℃
					</view>
					<view class="param-one">
						<text>输入过压保护值</text>
						<input v-model="chargeInfo.param5" class="uni-input inputs" type="digit"
							placeholder="输入过压保护值" />V
					</view>
					<view class="param-one">
						<text>输入欠压保护值</text>
						<input v-model="chargeInfo.param6" class="uni-input inputs" type="digit"
							placeholder="输入欠压保护值" />V
					</view>
					<view class="param-one">
						<text>输出过压保护值</text>
						<input v-model="chargeInfo.param7" class="uni-input inputs" type="digit"
							placeholder="输出过压保护值" />V
					</view>
					<view class="param-one">
						<text>输出欠压保护值</text>
						<input v-model="chargeInfo.param8" class="uni-input inputs" type="digit"
							placeholder="输出欠压保护值" />V
					</view>
					<view class="param-one">
						<text>充电过流保护值</text>
						<input v-model="chargeInfo.param9" class="uni-input inputs" type="digit"
							placeholder="充电过流保护值" />A
					</view>
				</view>
			</view>
		</uni-popup>

		<!-- 电池弹框 -->
		<uni-popup ref="batterypopup" type="center" class="bin_popup" :animation="false" :is-mask-click="false">
			<view class="alertbox binpopbox">
				<uni-icons class="closeempty" type="closeempty" size="30" color="#6A6A6A"
					@click="closeBinpopup('batterypopup')"></uni-icons>
				<view class="binparam">
					<view class="bin_left">
						电池{{currentIndex}}
					</view>
					<view class="param-one">
						<text>电池温度</text>
						<input v-model="batteryInfo.param1" class="uni-input inputs" type="digit" placeholder="电池温度" />℃
					</view>
					<view class="param-one">
						<text>电压失效</text>
						<input v-model="batteryInfo.param2" class="uni-input inputs" type="digit" placeholder="电压失效" />V
					</view>
					<view class="param-one">
						<text>电池/环境保护值</text>
						<input v-model="batteryInfo.param3" class="uni-input inputs" type="digit"
							placeholder="电池/环境保护值" />℃
					</view>
					<view class="param-one">
						<text>电池/环境恢复值</text>
						<input v-model="batteryInfo.param4" class="uni-input inputs" type="digit"
							placeholder="电池/环境恢复值" />℃
					</view>
					<view class="param-one">
						<text>MOS高温保护值</text>
						<input v-model="batteryInfo.param5" class="uni-input inputs" type="digit"
							placeholder="MOS高温保护值" />℃
					</view>
					<view class="param-one">
						<text>低温保护值</text>
						<input v-model="batteryInfo.param6" class="uni-input inputs" type="digit"
							placeholder="低温保护值" />℃
					</view>
					<view class="param-one">
						<text>低温恢复值</text>
						<input v-model="batteryInfo.param7" class="uni-input inputs" type="digit"
							placeholder="低温恢复值" />℃
					</view>
					<view class="param-one">
						<text>瞬时保护值</text>
						<input v-model="batteryInfo.param8" class="uni-input inputs" type="digit"
							placeholder="瞬时保护值" />V
					</view>
					<view class="param-one">
						<text>额定48V充电总压高保护</text>
						<input v-model="batteryInfo.param9" class="uni-input inputs" type="digit"
							placeholder="额定48V充电总压高保护" />V
					</view>

					<view class="param-one">
						<text>额定60V充电总压高保护</text>
						<input v-model="batteryInfo.param10" class="uni-input inputs" type="digit"
							placeholder="额定60V充电总压高保护" />V
					</view>
					<view class="param-one">
						<text>额定48V放电总压低保护</text>
						<input v-model="batteryInfo.param11" class="uni-input inputs" type="digit"
							placeholder="额定48V放电总压低保护" />V
					</view>
					<view class="param-one">
						<text>额定60V放电总压低保护</text>
						<input v-model="batteryInfo.param12" class="uni-input inputs" type="digit"
							placeholder="额定60V放电总压低保护" />V
					</view>
					<view class="param-one">
						<text>单体电压高瞬时保护</text>
						<input v-model="batteryInfo.param13" class="uni-input inputs" type="digit"
							placeholder="单体电压高瞬时保护" />V
					</view>
					<view class="param-one">
						<text>单体电压低瞬时保护</text>
						<input v-model="batteryInfo.param14" class="uni-input inputs" type="digit"
							placeholder="单体电压低瞬时保护" />V
					</view>
					<view class="param-one">
						<text>充电过流延时保护10S</text>
						<input v-model="batteryInfo.param15" class="uni-input inputs" type="digit"
							placeholder="充电过流延时保护10S" />A
					</view>
					<view class="param-one">
						<text>充电过流瞬时保护</text>
						<input v-model="batteryInfo.param16" class="uni-input inputs" type="digit"
							placeholder="充电过流瞬时保护" />A
					</view>
					<view class="param-one">
						<text>放电过流延时15S开限流</text>
						<input v-model="batteryInfo.param17" class="uni-input inputs" type="digit"
							placeholder="放电过流延时15S开限流" />A
					</view>
					<view class="param-one">
						<text>放电过流瞬时保护</text>
						<input v-model="batteryInfo.param18" class="uni-input inputs" type="digit"
							placeholder="放电过流瞬时保护" />A
					</view>
				</view>
			</view>
		</uni-popup>
		<!-- 柜控电源 弹框-->
		<uni-popup ref="cabinetpopup" type="center" class="bin_popup" :animation="false" :is-mask-click="false">
			<view class="alertbox binpopbox">
				<uni-icons class="closeempty" type="closeempty" size="30" color="#6A6A6A"
					@click="closeBinpopup('cabinetpopup')"></uni-icons>
				<view class="binparam">
					<view class="bin_left">
						柜控电源{{currentIndex}}
					</view>
					<view class="param-one">
						<text>高温保护值</text>
						<input v-model="cabenitInfo.param1" class="uni-input inputs" type="digit"
							placeholder="请输入高温保护值" />℃
					</view>
					<view class="param-one">
						<text>高温恢复值</text>
						<input v-model="cabenitInfo.param2" class="uni-input inputs" type="digit"
							placeholder="请输入高温恢复值" />℃
					</view>
					<view class="param-one">
						<text>低温保护值</text>
						<input v-model="cabenitInfo.param3" class="uni-input inputs" type="digit"
							placeholder="请输入低温保护值" />℃
					</view>
					<view class="param-one">
						<text>低温恢复值</text>
						<input v-model="cabenitInfo.param4" class="uni-input inputs" type="digit"
							placeholder="请输入低温恢复值" />℃
					</view>
					<view class="param-one">
						<text>默认输出电压</text>
						<input v-model="cabenitInfo.param5" class="uni-input inputs" type="digit"
							placeholder="请输入默认输出电压" />V
					</view>
					<view class="param-one">
						<text>输出过压保护值</text>
						<input v-model="cabenitInfo.param6" class="uni-input inputs" type="digit"
							placeholder="请输入输出过压保护值" />V
					</view>
					<view class="param-one">
						<text>输出欠压保护值</text>
						<input v-model="cabenitInfo.param7" class="uni-input inputs" type="digit"
							placeholder="请输入输出欠压保护值" />V
					</view>
					<view class="param-one">
						<text>输出过流保护值</text>
						<input v-model="cabenitInfo.param8" class="uni-input inputs" type="digit"
							placeholder="请输入输出欠压保护值" />A
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import {
		CURRENT_PLATFORM,
		LOCK_SIGNAL,
		LOCK_SIGNAL_SET,
		SMOKE_FEEDBACK,
		LOCK_STATUS,
		DOOR_FEEDBACK,
		WATER_STATUS,
	} from "@/common/config.js";
	import {
		DataGet,
		ab2hex,
		hexCharCodeToStr,
		arrayToBuffer
	} from "@/utils/index.js";
	import paramjs from "./param.js";
	
	export default {
		mixins: [paramjs],
		data() {
			return {
				type: 0, //参数类型

				paramTitle: "", //参数模块名称

				CURRENT_PLATFORM: CURRENT_PLATFORM,
				LOCK_SIGNAL: LOCK_SIGNAL,
				LOCK_SIGNAL_SET: LOCK_SIGNAL_SET,
				SMOKE_FEEDBACK: SMOKE_FEEDBACK,
				LOCK_STATUS: LOCK_STATUS,
				DOOR_FEEDBACK: DOOR_FEEDBACK,
				WATER_STATUS: WATER_STATUS,

				binNum: 0, //仓个数
				currentIndex: null, //当前仓号
				show: false,
				command: null, //命令字
				deviceInfo: {}, //设备信息
				dgMessage: "", //检测状态提示信息

				masterInfo: {
					param1: "",
					param2: "",
					param3: "",
					param4: "",
				},
				unitInfo: {
					param1: "",
					param2: "",
					param3: "",
					param4: "",
					param5: "",
					param6: "",
					param7: "",
					param8: "",
					param9: "",
					param10: "",
					param11: "",
					param12: "",
					param13: "",
				},
				powerInfo: {
					param1: "",
					param2: "",
					param3: "",
					param4: "",
					param5: "",
					param6: "",
					param7: "",
					param8: "",
					param9: "",
					param10: "",
					param11: "",
				},
				binDetail: {
					param1: "",
					param2: "",
					param3: "",
					param4: "",
					param5: "",
					param6: "",
					param7: "",
					param8: "",
					param9: "",
					param10: "",
					param11: "",
					param12: "",
					param13: "",
				},
				cabenitInfo: {
					param1: "",
					param2: "",
					param3: "",
					param4: "",
					param5: "",
					param6: "",
					param7: "",
					param8: "",
				},
				batteryInfo: {
					param1: "",
					param2: "",
					param3: "",
					param4: "",
					param5: "",
					param6: "",
					param7: "",
					param8: "",
					param9: "",
					param10: "",
					param11: "",
					param12: "",
					param13: "",
					param14: "",
					param15: "",
					param16: "",
					param17: "",
					param18: "",
				},
				chargeInfo: {
					param1: "",
					param2: "",
					param3: "",
					param4: "",
					param5: "",
					param6: "",
					param7: "",
					param8: "",
					param9: "",
				},
			}
		},
		computed: {
			// 柜控电源数量
			comCabinNum() {
				if (Number(this.binNum) < 24) {
					return 1;
				} else if (Number(this.binNum) >= 24 && Number(this.binNum) < 36) {
					return 2;
				} else {
					return 3;
				}
			},
		},
		onLoad(e) {
			this.deviceInfo = JSON.parse(decodeURIComponent(e.deviceInfo));
			this.type = e.type;
			this.binNum = e.binNum;
			switch (this.type) {
				case "0":
					this.paramTitle = "主控参数";
					this.command = 0;
					break;
				case "1":
					this.paramTitle = "仓控参数";
					this.command = 2;
					break;
				case "2":
					this.paramTitle = "检测单元参数";
					this.command = 1;
					break;
				case "3":
					this.paramTitle = "柜控电源";
					this.command = 3;
					break;
				case "4":
					this.paramTitle = "整流电源";
					this.command = 4;
					break;
				case "5":
					this.paramTitle = "充电电源";
					this.command = 7;
					break;
				case "6":
					this.paramTitle = "电池单元";
					this.command = 5;
					break;
			}
			this.dgMessage = this.paramTitle;
			// 进入页面，读取一次
			if (this.command == 0) {
				this.doRead();
			}
		},
		methods: {
			onKeyInput(e, key) {
				// let value = e.target.value.replace(/\D/g, '');
				// this.boxForm[key] = value;
			},
			isRefresh(addr) {
				let that = this;
				let index = addr ? Number(addr) - 1 : 0;
				uni.showModal({
					title: '提示',
					content: '确定要读取吗？',
					success(res) {
						if (res.confirm) {
							that.doRead(index);
						}
					}
				})
			},

			closeBinpopup(pop) {
				this.$refs[pop].close();
			},
			change(e) {
				this.show = e.show
			},
		},
	}
</script>

<style lang="scss" scoped>
	@import "@/static/css/common.scss";
	@import "../index.scss";

	.param-contents {
		padding: 20rpx;
		background: #ffffff;

		.param-one {
			@include flexLayout(center, flex-start);
			border-bottom: 2rpx solid #E5E5E5;
			font-size: 28rpx;
			color: #333333;
			padding: 10rpx 0;

			text {
				width: 220rpx;
				text-align: right;
				margin-right: 20rpx;
			}

			.labels {
				width: 130rpx;
			}

			.update-labels {
				width: 180rpx;
			}

			.inputs {
				width: calc(100% - 130rpx);
			}

			.address {
				line-height: 52rpx;
				width: calc(100% - 130rpx);
			}

			.update-inputs {
				width: calc(100% - 180rpx);
				text-align: left;
			}

			.mails {
				width: 180rpx;
			}

			.sliders {
				width: calc(100% - 250rpx);
			}

			.help_icon {
				margin-top: 12rpx;
			}

			.textarea-sn {
				width: 55%;
				max-height: 80rpx;
				border-width: 2rpx 20rpx;
				border-style: solid;
				border-color: #F7F7F7;
				line-height: 40rpx;
				font-size: 26rpx;
				padding: 20rpx 0;
			}
			.uni-input{
				width: 92%;
			}
		}

		.versions {
			min-height: 200rpx;
			border: 2rpx solid #efefef;
			padding: 20rpx;
		}

		.log_tips {
			color: red;
			font-size: 32rpx;
			margin: 30rpx 0 20rpx;
		}

		.operate_btns {
			text-align: center;
			margin: 60rpx 0;

			.set_btn {
				margin-left: 40rpx;
			}

			.update_btn {
				margin-left: 60%;
			}
		}

		.update_btns {
			text-align: right;
		}

		.param-title {
			border-left: 8rpx solid #0081ff;
			padding-left: 12rpx;
			border-radius: 8rpx;
			color: #0081ff;
			font-size: 36rpx;
			font-weight: bold;
			margin: 40rpx 0 12rpx;
		}

		.detail-name {
			font-size: 30rpx;
			margin-left: 10rpx;
		}

		::v-deep .u-tag {
			margin-top: 12rpx;
		}
	}
</style>